package com.gitee.wsl.ext.db

import androidx.room.Room
import androidx.room.RoomDatabase
import com.gitee.wsl.platform.Platform
import com.gitee.wsl.platform.appContext


actual inline fun <reified T : RoomDatabase> roomDatabaseBuilder(name: String, isMultiInstance:Boolean): RoomDatabase.Builder<T> {
    val dbFile = Platform.appContext.getDatabasePath(name)
    return Room.databaseBuilder<T>(
        context = Platform.appContext,
        name = dbFile.absolutePath,
    ).apply { if(isMultiInstance) enableMultiInstanceInvalidation() }
}